package com.gengzp.permission.config;

import com.gengzp.permission.interceptor.PermissionInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @ClassName PermissionInterceptorConfig
 * @Description 权限校验框架拦截器配置类
 * @Author gengzp
 * @Date 2025/8/25 20:42
 */
@Component
public class PermissionInterceptorConfig implements WebMvcConfigurer {

    @Autowired
    private PermissionInterceptor permissionInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 注册权限校验拦截器
        registry.addInterceptor(permissionInterceptor)
                .addPathPatterns("/**")   //拦截所有请求
        ;
    }

}
